{% macro render_field(field, class_='') %}
<div class="form-group mb-3">
    {{ field.label(class="form-label") }}
    {{ field(class=class_ + " form-control" + (" is-invalid" if field.errors else ""))|safe }}
    {% if field.errors %}
        <div class="invalid-feedback">
            {% for error in field.errors %}
                <span>{{ error }}</span>
            {% endfor %}
        </div>
    {% endif %}
</div>
{% endmacro %}
